<template>
  <CpNavBar :title="title"></CpNavBar>
  <van-skeleton :row="10" animate :loading="loading">
    <div class="pa-a1">
      <van-tabs v-model:active="active">
        <van-tab title="预警信息"><yjmessage :id="id"></yjmessage></van-tab>
        <van-tab title="预警明细"><getList></getList></van-tab>
        <van-tab title="处理信息"><getList></getList></van-tab>
      </van-tabs>
    </div>
  </van-skeleton>
</template>

<script lang="ts" setup>
import { useUserStore, useUserStores } from '@/stores'
import yjmessage from './components/yjmessage.vue'
import { onBeforeMount, onMounted, ref } from 'vue'
import getList from './components/getList.vue'
import { usrloging } from '@/utils/userHooks'

const id = ref()
const loading = ref(false)

const stores = useUserStores()
const store = useUserStore()
const title = ref('预警详情')
const active = ref(0)
onBeforeMount(() => {
  stores.deleteUsr()
})
onMounted(async () => {
  // if (!stores.users.token) {
  //   const isLoggedIn = await usrloging()
  //   if (isLoggedIn) {
  //     id.value = stores.users.id
  //     loading.value = false // 在这里可以放方法调用
  //   } else {
  //     console.error('用户未登录或登录失败')
  //   }
  // }
})
</script>

<style lang="scss" scoped>
.pa-a1 {
  padding-top: 50px;
  background: #ececec;
  height: 100vh;
  box-sizing: border-box;
}
</style>
